package com.sms.web.utils;

import javax.servlet.http.HttpSession;

import com.sms.common.Constants;
import com.sms.utils.ServletContextHolder;
import com.sms.web.system.entity.SysUser;

/**
 * @desc 用户工具类
 * @author WuJiangWu
 * @date 2018年7月22日下午7:06:54
 */
public abstract class UserUtils {
	
	/**
	 * 获取当前登陆用户
	 * @return
	 */
	public static SysUser  getCurrentUser() {
		HttpSession session = ServletContextHolder.getSession();
		SysUser user = (SysUser) session.getAttribute(Constants.USER_SESSION_NAME);
		return user;
	}
	
	/**
	 * 获取当前登陆用户id
	 * @return
	 */
	public static String  getUserId() {
		return getCurrentUser().getId();
	}
    
}
